<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Resources\SpecialTopicResource;
use Illuminate\Http\Request;
use App\Models\SpecialTopic;
class SpecialTopicController extends Controller
{
    public function  show(SpecialTopic $specialTopic){
        $today = now()->toDateString();
        $info =  $specialTopic->where("start_time","<",$today)
                     ->where("end_time",">",$today)
                     ->where("is_open","=",1)
                     ->orderBy("id","desc")
                     ->first();
        return new SpecialTopicResource($info);
    }
}
